package com.mebs.edi.model.edi.e214;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import com.mebs.edi.model.dom.DomAttribute;
import com.mebs.edi.model.dom.DomEntity;

/**
 * 
 * N1 section of a 214 EDI file 
 * 
 * @author nit
 *
 */
@Embeddable
@DomEntity(name = "N1")
public class Edi214N1 {
	
	@Column(nullable = true, length = 3)
	@DomAttribute
	private String n101; 	// Entity Identifier Code
	
	@Column(nullable = true, length = 60)
	@DomAttribute
	private String n102; 	// Name
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String n103; 	// Identification Code Qualifier
	
	@Column(nullable = true, length = 80)
	@DomAttribute
	private String n104; 	// Identification Code (Departure (Air) Port (IATA))
	
	public Edi214N1() {
		super();
	}

	public String getN101() {
		return n101;
	}

	public void setN101(String n101) {
		this.n101 = n101;
	}

	public String getN102() {
		return n102;
	}

	public void setN102(String n102) {
		this.n102 = n102;
	}

	public String getN103() {
		return n103;
	}

	public void setN103(String n103) {
		this.n103 = n103;
	}

	public String getN104() {
		return n104;
	}

	public void setN104(String n104) {
		this.n104 = n104;
	}

	@Override
	public String toString() {
		return "Edi214N1 [n101=" + n101 + ", n102=" + n102 + ", n103=" + n103 + ", n104=" + n104 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((n101 == null) ? 0 : n101.hashCode());
		result = prime * result + ((n102 == null) ? 0 : n102.hashCode());
		result = prime * result + ((n103 == null) ? 0 : n103.hashCode());
		result = prime * result + ((n104 == null) ? 0 : n104.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edi214N1 other = (Edi214N1) obj;
		if (n101 == null) {
			if (other.n101 != null)
				return false;
		} else if (!n101.equals(other.n101))
			return false;
		if (n102 == null) {
			if (other.n102 != null)
				return false;
		} else if (!n102.equals(other.n102))
			return false;
		if (n103 == null) {
			if (other.n103 != null)
				return false;
		} else if (!n103.equals(other.n103))
			return false;
		if (n104 == null) {
			if (other.n104 != null)
				return false;
		} else if (!n104.equals(other.n104))
			return false;
		return true;
	}
}
